//
//  Report.m
//  alotOf
//
//  Created by Mac_Black_Mini on 2025/9/2.
//

#import "Report.h"
#import "Tools.h"

NS_ASSUME_NONNULL_BEGIN

@implementation Report

+ (Report *)infoWithNode:(Node *)node {
    Report *model = [[Report alloc] init];
    model.app_version = Tools.appVersion;
    model.bundle = Tools.bundleId;
    model.uuid = Tools.deviceId;
//    model.session_id = LinkOperation.shared.sessionId;
    model.language = [[NSLocale preferredLanguages] firstObject];
    
    model.node_server = node.server;
    model.node_protocol = node.protocol;
//    model.node_id = node.id;
    
    
//    model.connect_duration = @(NSDate.date.timeIntervalSince1970 - Service.shared.startConnectTime).stringValue;
//    model.session_duration = @(NSDate.date.timeIntervalSince1970 - Service.shared.sessionStartTime).stringValue;
//    model.connect_event_time = @(Service.shared.startConnectTime).stringValue;
    
//    model.net_type = LinkOperation.shared.netType;
//    model.operator = LinkOperation.shared.carrierName;
    
    
    model.first_install_time = [NSUserDefaults.standardUserDefaults objectForKey:@"first_install_time"] ?: @"";
    NSString *lastUpgradeTimeInfo = [NSUserDefaults.standardUserDefaults objectForKey:@"last_upgrade_time"] ?: @"";
    NSArray *upgradeInfos = [lastUpgradeTimeInfo componentsSeparatedByString:@"-"];
    model.last_upgrade_time = upgradeInfos.lastObject;
    
    return model;
}

@end
NS_ASSUME_NONNULL_END
